/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package piedrapapeltijerasw;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import piedrapapeltijerasjpa.controllers.JugadorJpaController;
import piedrapapeltijerasjpa.entities.Jugador;

/**
 *
 * @author ias
 */
public class PiedraPapelTijera extends Application {
    
    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("Login.fxml"));
        
        Scene scene = new Scene(root);
        
        stage.setScene(scene);
        stage.show();
        
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("PiedraPapelTijerasJPAPU");
        
        JugadorJpaController jugadorJpaController = new JugadorJpaController(emf);
        Controllers.getInstance().setJugadorJpaController(jugadorJpaController);
        Jugador ju = new Jugador();
        ju.setCedula("123123");
        ju.setContrasena("adfadsf");
        ju.setUsuario("asdfasdf");
        jugadorJpaController.create(ju);
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}
